Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: EXPOSED-487 Add ability to pass custom sequence to auto-increment column #2197

Merged
merged 1 commit into from
Aug 14, 2024

Conversation

joc-a
Copy link
Collaborator

@joc-a joc-a commented Aug 13, 2024

Description

Summary of the change:
Add ability to pass custom sequence to auto-increment column.

Detailed description:

  • What:
    Added autoIncrement overload function that accepts a sequence of type org.jetbrains.exposed.sql.Sequence.
  • Why:
    I noticed that it even though it was possible to create a custom sequence using SchemaUtils.createSequence(mySequence) and manually call mySequence.nextIntVal() or mySequence.nextLongVal() when inserting, it was not possible to simply pass it to an auto-increment column to use internally.
  • How:
    A secondary constructor was added to AutoIncColumnType to pass it the custom sequence. A sequence field was also added to AutoIncColumnType and this field is now used instead of autoincSeq in SchemaUtils.kt where it was used to create/drop a sequence.

Type of Change

Please mark the relevant options with an "X":

  • Bug fix
  • New feature
  • Documentation update

Updates/remove existing public API methods:

  • Is breaking change

Affected databases:

  • MariaDB
  • Mysql5
  • Mysql8
  • Oracle
  • Postgres
  • SqlServer
  • H2
  • SQLite

Checklist

  • Unit tests are in place
  • The build is green (including the Detekt check)
  • All public methods affected by my PR has up to date API docs
  • Documentation for my change is up to date

Related Issues

@joc-a joc-a changed the title feat: Add ability to use custom sequence in auto-increment column feat: Add ability to pass custom sequence to auto-increment column Aug 13, 2024
@joc-a joc-a force-pushed the joc/feat-add-custom-sequence-to-column branch from 4d04247 to 2eb546d Compare August 13, 2024 14:46
@joc-a joc-a marked this pull request as ready for review August 13, 2024 22:23
@joc-a joc-a requested review from bog-walk, obabichevjb and e5l and removed request for obabichevjb August 13, 2024 22:23
Copy link
Member

@e5l e5l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Please consider logging a YT issue and mentioning it in the PR title

@joc-a joc-a changed the title feat: Add ability to pass custom sequence to auto-increment column feat: EXPOSED-487 Add ability to pass custom sequence to auto-increment column Aug 14, 2024
@joc-a joc-a force-pushed the joc/feat-add-custom-sequence-to-column branch from 2eb546d to ae61cc8 Compare August 14, 2024 13:41
@joc-a joc-a merged commit 7171f42 into main Aug 14, 2024
5 checks passed
@joc-a joc-a deleted the joc/feat-add-custom-sequence-to-column branch August 14, 2024 16:09
@bog-walk bog-walk linked an issue Aug 19, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Better customisation of sequences
2 participants